<?php
class DateTimeSelectAssociate
{
	protected $startDateTimeSelect;
	protected $endDateTimeSelect;
	
	public function setStartDateTimeSelect($start)
	{
		$this->startDateTimeSelect = $start;
	}
	
	public function setEndDateTimeSelect($end)
	{
		$this->endDateTimeSelect = $end;
	}
	
	public function getHTML()
	{
		// initial behaviour is for end to follow start
		
		$html = "<script language=\"javascript\" id=\"".$this->startDateTimeSelect."Associate\">\n";
		$html .= "function ".$this->startDateTimeSelect."Associate(unit)\n";
		$html .= "{\n";
//		$html .= "alert(unit);\n";
//		$html .= "alert('".$this->startDateTimeSelect."'+unit);\n";
		$html .= "aValue = document.getElementById('".$this->startDateTimeSelect."'+unit).value;\n";
//		$html .= "alert(aValue)\n";
//		$html .= "alert(document.getElementById('".$this->endDateTimeSelect."'+unit).value)\n";
		$html .= "document.getElementById('".$this->endDateTimeSelect."'+unit).value = aValue;\n";
		$html .= $this->endDateTimeSelect."update('none')\n";
		$html .= "}\n";
		$html .= "";
		$html .= "";
		$html .= "";
		$html .= "";
		$html .= "</script>\n";
		return $html;
	}
}